<template>
  <div id="dragdemo">
    <div style="min-height:30px;display:flex;line-height:30px;padding:10px 0;border-bottom:1px #ccc solid;
    margin-bottom:10px;" v-if="!drag_edit">
      <el-button type="primary" v-on:click="drag_edit=true" style="margin-left: auto;">启用编辑</el-button>
    </div>
    <div style="min-height:30px;display:flex;line-height:30px;padding:10px 0;border-bottom:1px #ccc solid;
    margin-bottom:10px;" v-else>
      <el-checkbox v-model="show_grid"  @change="grid_show" style="margin:0 20px;margin-left: auto;">显示网格</el-checkbox>
      <el-button v-on:click="drag_edit=false">取消编辑</el-button>
      <el-button type="primary" v-on:click="drag_edit=false">重置</el-button>
      <el-button type="success">保存</el-button>
    </div>
    <!----拖拽布局↓---->
    <div ref="drag_dom" class="g-drag" :class="{'g-drag-edit':drag_edit,'g-drag-edit-grid':show_grid}">
      <!----第一列---->
      <div class="g-drag-item" grid-x="0" grid-y="0" grid-w="4" grid-h="3">
        <div class="g-drag-car">
            1111111111111111
        </div>
      </div>
      <div class="g-drag-item" grid-x="0" grid-y="0" grid-w="4" grid-h="4">
        <div class="g-drag-car">
            1111111111111111
        </div>
      </div>
      <div class="g-drag-item" grid-x="0" grid-y="0" grid-w="4" grid-h="2.5">
        <div class="g-drag-car">
            1111111111111111-------------
        </div>
      </div>
      <div class="g-drag-item" grid-x="0" grid-y="0" grid-w="4" grid-h="3">
        <div class="g-drag-car">
            1111111111111111
        </div>
      </div>

      <!----第二列---->
      <div class="g-drag-item" grid-x="4" grid-y="0" grid-w="4" grid-h="2">
        <div class="g-drag-car">
            2222222222222222222
        </div>
      </div>
      <div class="g-drag-item" grid-x="4" grid-y="0" grid-w="4" grid-h="4">
        <div class="g-drag-car">
            2222222222222222222
        </div>
      </div>
      <div class="g-drag-item" grid-x="4" grid-y="0" grid-w="4" grid-h="3">
        <div class="g-drag-car">
            2222222222222222222
        </div>
      </div>

      <!----第三列---->
      <div class="g-drag-item" grid-x="8" grid-y="0" grid-w="4" grid-h="4">
        <div class="g-drag-car">
            33333333333333333333
        </div>
      </div>
      <div class="g-drag-item" grid-x="8" grid-y="0" grid-w="4" grid-h="2">
        <div class="g-drag-car">
            333333333333333333333333333333333333333333333333333333333333
        </div>
      </div>
      <div class="g-drag-item" grid-x="8" grid-y="0" grid-w="4" grid-h="3">
        <div class="g-drag-car">
            33333333333333333333
        </div>
      </div>
      <div class="g-drag-item" grid-x="8" grid-y="0" grid-w="4" grid-h="6">
        <div class="g-drag-car">
            33333333333333333333
        </div>
      </div>
    </div>
    <!----拖拽布局end---->
  </div>
</template>

<script>
 import dragReady from "./grid-drag"
 
export default {
  data() {
    return {
      drag_edit:false,
      show_grid:false
    }
  },
  methods: {
    grid_show(ce){
    }
  },
  computed: {
  },
  watch: {
  },
  created() {
    
  },
  mounted (){
    dragReady()
  }
}
</script>
<style lang="scss">
#dragdemo{
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  display: block;
  // flex: 1;
}

</style>